<%-- 
    Document   : common
    Created on : Apr 22, 2013, 5:20:59 PM
    Author     : TNT
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%!
	public String getVal(String strVal,String def)
	{
		return (strVal==null?def:strVal);
	}
	
	public String replaceString(String sStr,String oldStr,String newStr)
	{
		sStr=(sStr==null?"":sStr);
		String strVar=sStr;
		String tmpStr="";
		String finalStr="";
		int stpos=0,endpos=0,strLen=0;
		while (true)
		{
		strLen=strVar.length();
		stpos=0;
		endpos=strVar.indexOf(oldStr,stpos);
		if (endpos==-1)
		break;
		tmpStr=strVar.substring(stpos,endpos);
		tmpStr=tmpStr.concat(newStr);
		strVar=strVar.substring(endpos+oldStr.length()>sStr.length()?endpos:endpos+oldStr.length(),strLen);
		finalStr=finalStr.concat(tmpStr);
		stpos=endpos;
		}
		finalStr=finalStr.concat(strVar);
		return finalStr;
	}
%>
    </body>
</html>
